package com.atguigu.yygh.controller;

import com.atguigu.yygh.result.Result;
import com.atguigu.yygh.service.UserInfoService;
import com.atguigu.yygh.vo.user.LoginVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Api(tags = "登录模块接口")
@RestController
@RequestMapping("/api/user")
public class UserInfoApiController {

    @Autowired
    private UserInfoService userInfoService;

    //1.用户手机号登录
    @ApiOperation(value = "1.用户手机号登录")
    @PostMapping("/login")
    public Result login(@RequestBody LoginVo loginVo) {
        Map<String, Object> info = userInfoService.loginUser(loginVo);
        return Result.ok(info);
    }



    @Value("${server.port}")
    private String port;

    //1.用户手机号登录
    @ApiOperation(value = "2.sentinel测试专用")
    @PostMapping("/indeex")
    public String indeex() {
        return port;
    }

    //1.用户手机号登录
    @ApiOperation(value = "3.链路测试test1专用")
    @PostMapping("/test1")
    public String test1() {
        return "test1";
    }
    //1.用户手机号登录
    @ApiOperation(value = "4.链路测试test2专用")
    @PostMapping("/test2")
    public String test2() {
        return "test2";
    }
}